package com.epoint.rest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@RestController
public class FileUploadRest {

    @RequestMapping("/fileupload")
    public String fileupload(@RequestPart("exampleInputFile")MultipartFile exampleInputFile) throws IOException {
        if(!exampleInputFile.isEmpty()){
            exampleInputFile.transferTo(new File("X:\\坚果云同步文件夹\\学习资料\\玩转spring\\code\\springtest\\src\\main\\resources\\fileupload\\" + new String(exampleInputFile.getOriginalFilename().getBytes(), "UTF-8")));
        }
        return "main.html";
    }

}
